// ===============================================
// page_status
//
// Create by Will on 14/9/2023 15:33
// Copyright Will .All rights reserved.
// ===============================================

import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';

import '../../../assets/res.dart';

class PageStatus {
  PageStatus._internal();
  //无数据
  static Widget noData({String? text, String? curImage}) {
    return Container(
      padding: const EdgeInsets.symmetric(vertical: 20),
      alignment: Alignment.center,
      child: Center(
        child: Image.asset(
          curImage ?? Res.imagesUserIcNoData,
          fit: BoxFit.contain,
          height: 140,
        ),
      ),
    );
  }

  //加载中
  static Widget loading({
    bool enableTouch = false,
    double? width,
    double? height,
  }) {
    if (enableTouch) {
      return GestureDetector(
        onTap: () {},
        child: Container(
          width: width ?? double.infinity,
          height: height ?? double.infinity,
          color: Colors.transparent,
          alignment: Alignment.center,
          child: SpinKitFadingCircle(
            size: 48,
          ),
        ),
      );
    } else {
      return Container(
        color: Colors.transparent,
        alignment: Alignment.center,
        child: SpinKitFadingCircle(
          size: 48,
        ),
      );
    }
  }
}
